<?php

/*

  Action	$3

  +1 Action
  Reveal your hand. If there are no duplicate cards in it, +3 Cards. Otherwise, +1 Card.

 */

class Menagerie extends Card implements iAction, iKingdom, iCornucopia {

    public function __construct() {
        parent::__construct("Menagerie", 3);
        $this->undoPlay = false;
        $this->undoBuy = true;
    }

    public function getDescription() {
        return array(
            "+1 Action",
            "Reveal your hand. If there are no duplicate cards in it, +3 Cards. Otherwise, +1 Card.");
    }

    public function play(Game $game, $isRealCard) {
        $game->addActions(1);
        $playhand = $game->getPlayHand();
        ScreenDisplay::addScreenMessage($game, true, "reveal " . nicePrint($playhand), "reveals ".ScreenDisplay::$LMSG);
        $unique = getUniqueCards($playhand);
        if (sizeof($unique) == sizeof($playhand)) {
            $drawed_cards = $game->drawCards(3);
            ScreenDisplay::addScreenMessage($game, true, "get +1 action  and draw " . nicePrint($drawed_cards), "gets +1 action and draws " . sizeof($drawed_cards) . " cards");
        } else {
            $drawed_cards = $game->drawCards(1);
            ScreenDisplay::addScreenMessage($game, true, "get +1 action  and draw " . nicePrint($drawed_cards), "gets +1 action and draws " . sizeof($drawed_cards) . " cards");
        }
		$game->cardActionFinished();
        return true;
    }

}

?>